//-
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

include /app/helpers/jade/mixins
include /app/configuration/mixins

-var form = 'ipc'
-var model = 'backupItem'

panel-collapsible(ng-form=form on-open=`ui.loadPanel('${form}')`)
    panel-title IPC
    panel-description IGFS Inter-process communication properties.
    panel-content.pca-form-row(ng-if=`ui.isPanelLoaded('${form}')`)
        .pca-form-column-6.pc-form-grid-row
            -var ipcEndpointConfiguration = `${model}.ipcEndpointConfiguration`
            -var enabled = `${model}.ipcEndpointEnabled`

            .pc-form-grid-col-60
                +form-field__checkbox({
                    label: 'Enabled',
                    model: enabled,
                    name: '"ipcEndpointEnabled"',
                    tip: 'IPC endpoint enabled flag'
                })
            .pc-form-grid-col-60
                +form-field__dropdown({
                    label: 'Type:',
                    model: `${ipcEndpointConfiguration}.type`,
                    name: '"ipcEndpointConfigurationType"',
                    disabled: `!(${enabled})`,
                    placeholder: 'TCP',
                    options: '[\
                        {value: "SHMEM", label: "SHMEM"},\
                        {value: "TCP", label: "TCP"}\
                    ]',
                    tip: 'IPC endpoint type\
                        <ul>\
                            <li>SHMEM - shared memory endpoint</li>\
                            <li>TCP - TCP endpoint</li>\
                        </ul>'
                })
            .pc-form-grid-col-30
                +form-field__ip-address({
                    label: 'Host:',
                    model: `${ipcEndpointConfiguration}.host`,
                    name: '"ipcEndpointConfigurationHost"',
                    enabled: enabled,
                    placeholder: '127.0.0.1',
                    tip: 'Host endpoint is bound to'
                })
            .pc-form-grid-col-30
                +form-field__number({
                    label: 'Port:',
                    model: `${ipcEndpointConfiguration}.port`,
                    name: '"ipcEndpointConfigurationPort"',
                    disabled: `!(${enabled})`,
                    placeholder: '10500',
                    min: '1',
                    max: '65535',
                    tip: 'Port endpoint is bound to'
                })
            .pc-form-grid-col-30
                +form-field__number({
                    label: 'Memory size:',
                    model: `${ipcEndpointConfiguration}.memorySize`,
                    name: '"ipcEndpointConfigurationMemorySize"',
                    disabled: `!(${enabled})`,
                    placeholder: '262144',
                    min: '1',
                    tip: 'Shared memory size in bytes allocated for endpoint communication'
                })
            .pc-form-grid-col-30
                +form-field__number({
                    label: 'Thread count:',
                    model: `${ipcEndpointConfiguration}.threadCount`,
                    name: '"ipcEndpointConfigurationThreadCount"',
                    disabled: `!(${enabled})`,
                    placeholder: 'availableProcessors',
                    min: '1',
                    tip: 'Number of threads used by this endpoint to process incoming requests'
                })
            .pc-form-grid-col-60
                +form-field__text({
                    label: 'Token directory:',
                    model: `${ipcEndpointConfiguration}.tokenDirectoryPath`,
                    name: '"ipcEndpointConfigurationTokenDirectoryPath"',
                    disabled: `!(${enabled})`,
                    placeholder: 'ipc/shmem',
                    tip: 'Directory where shared memory tokens are stored'
                })
        .pca-form-column-6
            +preview-xml-java(model, 'igfsIPC')
